VERSION = 1.0.1

ifeq ($(V),1)
Q :=
ECHO := @true
else
Q := @
ECHO := @echo
endif

TOP := .
VPATH ?= 
BINNAME ?= openRtsp

#-------------------------------------------------------------------------------
#		Setup cross-compilation tools
#-------------------------------------------------------------------------------
# Tool suffix when cross-compiling
CROSS_COMPILE ?=
#CROSS_COMPILE ?= arm-none-eabi-

# Compilation tools
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
AR = $(CROSS_COMPILE)ar

#-------------------------------------------------------------------------------
#		Setup compilation params
#-------------------------------------------------------------------------------

CFLAGS_OPT ?= -Os

# compiler flags
CFLAGS = $(CFLAGS_OPT)

# Trace level used for compilation
# (can be overriden by adding TRACE_LEVEL=#number to the command-line)
# TRACE_LEVEL_DEBUG      5
# TRACE_LEVEL_INFO       4
# TRACE_LEVEL_WARNING    3
# TRACE_LEVEL_ERROR      2
# TRACE_LEVEL_FATAL      1
# TRACE_LEVEL_NO_TRACE   0
ifdef DEBUG
TRACE_LEVEL ?= 5
CFLAGS_DEFS += -DTRACE_LEVEL=$(TRACE_LEVEL)
CFLAGS += -g3
CFLAGS_ASM += -g3
else
TRACE_LEVEL ?= 4
endif 

LDFLAGS ?= 

CXXFLAGS ?= -std=gnu++0x

LDCXXFLAGS += -Wl,--warn-common,--gc-section -fno-builtin -fcheck-new -Wall -Wshadow -Wundef -Os -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer 
#LDCXXFLAGS += -Wl,-rpath=$(TOP)/lib lib/libhiredis.so

#live555 lib 链接顺序不能变
LDCXXFLAGS += -L /usr/local/lib -lliveMedia -lgroupsock -lUsageEnvironment -lBasicUsageEnvironment
LDCXXFLAGS += -L /usr/local/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lavcodec -lavutil -lswscale -lavformat

CXXFLAGS_INC += -I./include -I/usr/local/include
CXXFLAGS_INC += -I/usr/local/include/BasicUsageEnvironment -I/usr/local/include/groupsock -I/usr/local/include/liveMedia -I/usr/local/include/UsageEnvironment

include $(TOP)/Makefile.rules
